package tor;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.UnknownHostException;
import java.security.interfaces.RSAPrivateCrtKey;
import java.security.interfaces.RSAPublicKey;

import org.silvertunnel.netlib.api.NetFactory;
import org.silvertunnel.netlib.api.NetLayer;
import org.silvertunnel.netlib.api.NetLayerIDs;
import org.silvertunnel.netlib.api.NetSocket;
import org.silvertunnel.netlib.layer.tor.TorHiddenServicePortPrivateNetAddress;
import org.silvertunnel.netlib.layer.tor.TorHiddenServicePrivateNetAddress;
import org.silvertunnel.netlib.layer.tor.TorNetLayer;
import org.silvertunnel.netlib.layer.tor.TorNetLayerUtil;
import org.silvertunnel.netlib.layer.tor.TorNetServerSocket;

public class TorServer {
	
	public TorServer(){};
	
	public void run(){
		TorNetLayerUtil torNetLayerUtil = TorNetLayerUtil.getInstance();
			    TorHiddenServicePrivateNetAddress newNetAddress = torNetLayerUtil.createNewTorHiddenServicePrivateNetAddress();

			    // write new private+public hidden service key to directory
			    File directory = new File("/dir/to/the/hidden/service"); 
			    directory.mkdir();
			    try {
					torNetLayerUtil.writeTorHiddenServicePrivateNetAddressToFiles(directory, newNetAddress);
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
	}
}
